Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Generate completions during build process #53

Closed

Conversation

DSpeckhals
Copy link
Contributor

@DSpeckhals DSpeckhals commented Oct 26, 2020

This commit adds a build.rs which generates completion files for Bash,
Elvish, Fish, and zsh shells. In order to accomplish this, the
build_cli command was moved into a separate module: cli. The CI
build script was also modified to package the four scripts into the
outputted build artifact.

One downside of pre-generating the completion scripts is that it won't
be able to take user-specified profiles, as those are dependent on each
system. That would require custom generations, and would probably no
longer able to be auto-generated with clap.

Note: I have not actually tested out the CI script yet. I would recommend doing that before merging this.

Fixes #53

This commit adds a `build.rs` which generates completion files for Bash,
Elvish, Fish, and zsh shells. In order to accomplish this, the
`build_cli` command was moved into a separate module: `cli`. The CI
build script was also modified to package the four scripts into the
outputted build artifact.

One downside of pre-generating the completion scripts is that it won't
be able to take user-specified profiles, as those are dependent on each
system. That would require custom generations, and would probably no
longer able to be auto-generated with clap.
@oknozor oknozor mentioned this pull request Oct 28, 2020
4 tasks
@oknozor
Copy link
Owner

oknozor commented Oct 28, 2020

@DSpeckhals nice to see we are close to have some decent packaging for various distro.
I think we should wait for #4 to be implemented before merging this.

@oknozor oknozor force-pushed the v2.0.0-rc branch 16 times, most recently from ebd4bdf to 888b90b Compare May 16, 2021 16:00
@Nukesor
Copy link
Contributor

Nukesor commented Feb 2, 2022

It would also be good to update to clapv3 beforehand.

The way completion files are generated changed a bit with their v3 release, as there's now a dedicated crate for this functionality.

I assume this whole PR would need to be rewritten anyway, as it probably also makes sense to use clap via their new "structopt" declaration while you're at it. It's also the recommended way to use clap right now.

@svenstaro
Copy link
Contributor

This MR is old and has conflicts. Is @DSpeckhals willing to pick this back up?

@oknozor
Copy link
Owner

oknozor commented Nov 29, 2022

Closing this since there is no activity.
Also I think installing completion should be done per distro package.

@oknozor oknozor closed this Nov 29, 2022
@Nukesor
Copy link
Contributor

Nukesor commented Nov 29, 2022

I think this can be closed as "done", as there's now a subcommand to generate auto-completions at all :)
(Maybe it was there before, but I didn't see it^^).

Moving them to the correct location in the system is indeed the distro packager's job

@svenstaro
Copy link
Contributor

For the record, Arch has had those for quite some time now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants